domoticz: improve config, don't require telldus
authorDavid Woodhouse <dwmw2@infradead.org>
Mon, 17 Nov 2025 13:41:06 +0000 (13:41 +0000)
committerDavid Woodhouse <dwmw2@infradead.org>
Fri, 12 Dec 2025 03:03:15 +0000 (12:03 +0900)
Add support for configuring the -vhostname, as it helps to get the right
issuer into OAuth2 tokens. Also disable the mdns responder by default;
when we're running on OpenWrt we have better options that that. Clean
up the logging options, and also make it export $TZ to work around our
musl hack which otherwise opens and reads /etc/TZ thousands of times
a minute.

Also drop the telldus dependency. Domoticz will dlopen that at runtime
without having to have it present at build time at all, so it should
still work for users who install it.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
utils/domoticz/Makefile
utils/domoticz/files/domoticz.config
utils/domoticz/files/domoticz.init
utils/domoticz/patches/001-domoticz-2025.2-no-telldus.patch [new file with mode: 0644]

index 264c097ce158e772d72c94b3005d49ad9cb6731c..d275f2dc7dec1f38cd7a07b7971742571825091e 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=domoticz
 PKG_VERSION:=2025.2
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://codeload.github.com/domoticz/domoticz/tar.gz/$(PKG_VERSION)?
@@ -47,7 +47,6 @@ define Package/domoticz
        +libopenzwave \
        +libsqlite3 \
        +libstdcpp \
-       +telldus-core \
        +zlib
 endef
 
@@ -72,7 +71,8 @@ CMAKE_OPTIONS += \
        -DUSE_STATIC_OPENZWAVE=no \
        -DUSE_OPENSSL_STATIC=no \
        -DUSE_PYTHON=yes \
-       -DWITH_LIBUSB=no
+       -DWITH_LIBUSB=no \
+       -DWITH_TELLDUSCORE=no
 
 TARGET_CXXFLAGS += -DWITH_GPIO
 
index 870701c050114f4949cce2bc486f93e4762d27a0..51bdfd5dc4fab39c4c63bdff96f9b2f9be788865 100644 (file)
@@ -1,11 +1,18 @@
 config domoticz
        option disabled '1'
-       option loglevel '1'
+       # (combination of: all,normal,status,error,debug)
+       option loglevel 'normal'
+       # (combination of: all,normal,hardware,received,webserver,eventsystem,python,thread_id,sql,auth)
+       option debuglevel 'normal'
+       # [user|daemon|local0 .. local7]
        option syslog 'daemon'
+       # You can point it at ACME certs directly and it reloads automatically when they change.
        # option sslcert '/path/to/ssl.crt'
        # option sslkey '/path/to/ssl.key'
        # option sslpass 'passphrase'
        # option ssldhparam '/path/to/dhparam.pem'
+       # option mdns '0'
+       # option www '8080'
        option sslwww '0'
        # CAUTION - by default, /var is not persistent accross reboots
        # Don't forget the trailing / - domoticz requires it
index 0cf563170d52ea47c83adccd5bde6e62c20a6278..eb61bb2d2a59387a147c3ab4c9add6666823f23c 100644 (file)
@@ -7,18 +7,22 @@ PIDFILE=/var/run/domoticz.pid
 
 start_domoticz() {
        local section="$1"
-       local disabled loglevel sslcert sslpass sslwww syslog userdata
+       local disabled loglevel debuglevel mdns sslcert sslpass sslwww www syslog vhostname userdata
 
        config_get_bool disabled "$section" "disabled" 0
        [ "$disabled" -gt 0 ] && return
 
        config_get loglevel "$section" "loglevel"
+       config_get debuglevel "$section" "debuglevel"
+       config_get_bool mdns "$section" "mdns" 0
        config_get sslcert "$section" "sslcert"
        config_get sslkey "$section" "sslkey"
        config_get sslpass "$section" "sslpass"
        config_get ssldhparam "$section" "ssldhparam"
        config_get sslwww "$section" "sslwww"
+       config_get www "$section" "www"
        config_get syslog "$section" "syslog"
+       config_get vhostname "$section" "vhostname"
        config_get userdata "$section" "userdata" userdata /var/lib/domoticz
 
        procd_open_instance
@@ -26,8 +30,12 @@ start_domoticz() {
        procd_append_param command -noupdates
        procd_append_param command -approot /usr/share/domoticz/
 
+       [ "$mdns" -eq 0 ] && procd_append_param command "-nomdns"
        [ -n "$loglevel" ] && procd_append_param command -loglevel "$loglevel"
+       [ -n "$debuglevel" ] && procd_append_param command -debuglevel "$debuglevel"
        [ -n "$syslog" ] && procd_append_param command -syslog "$syslog"
+       [ -n "$vhostname" ] && procd_append_param command -vhostname "$vhostname"
+       [ -n "$www" ] && procd_append_param command -www "$www"
 
        [ -d "${userdata}" ] || {
                mkdir -p "${userdata}"
@@ -56,6 +64,10 @@ start_domoticz() {
                [ -n "$ssldhparam" ] && procd_append_param command -ssldhparam "$ssldhparam"
        } || procd_append_param command -sslwww 0
 
+       # OpenWrt musl has a hack to read /etc/TZ every time if $TZ isn't set.
+       # Work around it by setting $TZ
+       [ -r "/etc/TZ" ] && procd_append_param env TZ="$(cat /etc/TZ)"
+
        procd_set_param pidfile "$PIDFILE"
        procd_set_param respawn
        procd_set_param stdout 0
diff --git a/utils/domoticz/patches/001-domoticz-2025.2-no-telldus.patch b/utils/domoticz/patches/001-domoticz-2025.2-no-telldus.patch
new file mode 100644 (file)
index 0000000..8b85990
--- /dev/null
@@ -0,0 +1,41 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -32,6 +32,7 @@ option(USE_PYTHON "Use Python for Plugin
+ option(INCLUDE_LINUX_I2C "Include I2C support" YES)
+ option(INCLUDE_SPI "Include SPI support" YES)
+ option(WITH_LIBUSB "Enable libusb support" YES)
++option(WITH_TELLDUSCORE "Enable Telldus support" YES)
+ # Link static or shared, external dependencies
+ option(USE_LUA_STATIC "Link LUA static" YES)
+@@ -783,17 +784,19 @@ ELSE()
+   message(STATUS "GPIO is not available")
+ ENDIF()
+-find_path(TELLDUSCORE_INCLUDE NAMES telldus-core.h)
+-IF(TELLDUSCORE_INCLUDE)
+-  message(STATUS "Found telldus-core (telldus-core.h) at : ${TELLDUSCORE_INCLUDE}")
+-  find_library(TELLDUS_LIBRARIES NAMES libtelldus-core.so)
+-  IF(TELLDUS_LIBRARIES)
+-    message(STATUS "Found libtelldus-core at : ${TELLDUS_LIBRARIES}, adding telldus support")
+-    add_definitions(-DWITH_TELLDUSCORE)
+-  ENDIF(TELLDUS_LIBRARIES)
+-ELSE()
+-  message(STATUS "Not found telldus-core (telldus-core.h), not adding tellstick support")
+-ENDIF(TELLDUSCORE_INCLUDE)
++IF(WITH_TELLDUSCORE)
++  find_path(TELLDUSCORE_INCLUDE NAMES telldus-core.h)
++  IF(TELLDUSCORE_INCLUDE)
++    message(STATUS "Found telldus-core (telldus-core.h) at : ${TELLDUSCORE_INCLUDE}")
++    find_library(TELLDUS_LIBRARIES NAMES libtelldus-core.so)
++    IF(TELLDUS_LIBRARIES)
++      message(STATUS "Found libtelldus-core at : ${TELLDUS_LIBRARIES}, adding telldus support")
++      add_definitions(-DWITH_TELLDUSCORE)
++    ENDIF(TELLDUS_LIBRARIES)
++  ELSE()
++    message(STATUS "Not found telldus-core (telldus-core.h), not adding tellstick support")
++  ENDIF(TELLDUSCORE_INCLUDE)
++ENDIF(WITH_TELLDUSCORE)
+ # Handle resolving
+ check_function_exists(res_init HAVE_LIBC_RESOLV)